home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / bavarian / 011-020 / 014_anwendungen_3 / 3 malprogramme / sketch master (.txt) < prev    next >
AmigaBASIC Source Code  |  1993-11-04  |  2KB  |  118 lines

  1. start:
  2. SCREEN 1,320,200,4,1
  3. WINDOW 2,"sketch master",(0,0)-(311,185),12,1
  4. clr=1
  5. CLS
  6. MENU 1,0,1,"tools"
  7. MENU 1,1,1,"point"
  8. MENU 1,2,1,"line"
  9. MENU 1,3,1,"box"
  10. MENU 1,4,1,"circle"
  11. MENU 1,5,1,"paint"
  12. MENU 1,6,1,"triangle"
  13. MENU 1,7,1,"clear "
  14. MENU 1,8,1,"stop"
  15.  
  16. MENU 2,0,1,"colors"
  17. MENU 2,1,1,"blue"
  18. MENU 2,2,1,"white"
  19. MENU 2,3,1,"black"
  20. MENU 2,4,1,"orange"
  21. MENU 2,5,1,"dk blue"
  22. MENU 2,6,1,"violet"
  23. MENU 2,7,1,"aqua"
  24. MENU 2,8,1,"grey"
  25.  
  26. MENU 3,0,1,"colors"
  27. MENU 3,1,1,"brown"
  28. MENU 3,2,1,"red"
  29. MENU 3,3,1,"lime"
  30. MENU 3,4,1,"yellow"
  31. MENU 3,5,1,"skyblue"
  32. MENU 3,6,1,"purple"
  33. MENU 3,7,1,"green"
  34. MENU 3,8,1,"dk grey"
  35.  
  36. MENU ON
  37. ON MENU GOSUB settool
  38. REM mouse control
  39.  
  40. loop: f=MOUSE(0)
  41. IF f=-1 THEN temp
  42. IF f=0 THEN loop
  43. IF f=1 THEN draw
  44. GOTO loop
  45.  
  46. temp:  IF ch=7 THEN temp
  47.        x1=MOUSE(3) :y1=MOUSE(4)
  48.        x2=MOUSE(5) : y2=MOUSE(6)
  49.        ON ch GOSUB tpt,tln,tbx,tcr,pnt,ttri
  50.        GOTO loop 
  51.       
  52. draw:   IF ch=7 THEN temp
  53.         x1=MOUSE(3) : y1=MOUSE(4)
  54.         x2=MOUSE(5) : y2=MOUSE(6)
  55.         ON ch GOSUB tpt,ln,bx,cr,pnt,tri
  56.         GOTO loop
  57.  
  58. tpt:   PSET (x1,y1),clr
  59.        z=MOUSE(0) : IF z>0 THEN RETURN
  60.        x1=MOUSE(1) : y1=MOUSE(2)
  61.        GOTO tpt
  62.  
  63. tln:   LINE (x1,y1)-(x2,y2),clr
  64.        LINE (x1,y1)-(x2,y2),0
  65.        RETURN
  66.         
  67. ln:    LINE (x1,y1)-(x2,y2),clr
  68.        RETURN
  69.  
  70. tbx:   LINE (x1,y1)-(x2,y2),clr,b
  71.        LINE (x1,y1)-(x2,y2),0,b
  72.        RETURN
  73.        
  74. bx:    LINE (x1,y1)-(x2,y2),clr,b
  75.        RETURN
  76.  
  77. tcr:   IF ABS(x1-x2)<11 THEN RETURN
  78.        CIRCLE (x1,y1),x2-x1,clr,,,0.88
  79.        CIRCLE (x1,y1),x2-x1,0,,,0.88
  80.        RETURN
  81.  
  82. cr:   IF ABS(x1-x2)<11 THEN RETURN
  83.       CIRCLE (x1,y1),x2-x1,clr,,,0.88
  84.       RETURN            
  85.                                    
  86. pnt:  PAINT (x1,y1),clr,clr
  87.       RETURN
  88.  
  89. ttri: LINE (x1,y1)-(x2,y2),clr
  90.       LINE (x2,y2)-STEP (40,40),clr : LINE -(x1,y1),clr
  91.       LINE (x1,y1)-(x2,y2),0
  92.       LINE (x2,y2)-STEP (40,40),0 : LINE -(x1,y1),0       
  93.       RETURN
  94.       
  95. tri:  LINE (x1,y1)-(x2,y2),clr
  96.       LINE (x2,y2)-STEP (40,40),clr : LINE -(x1,y1),clr
  97.       RETURN
  98.  
  99. scn:  CLS : RETURN
  100.        
  101. settool: mn=MENU(0)
  102.          ON mn GOSUB tools,c1,c2
  103.          RETURN
  104.  
  105. tools: ch=MENU(1)
  106.        IF ch=7 THEN GOSUB scn
  107.        IF ch=8 THEN fini
  108.        RETURN
  109.  
  110. c1: clr=MENU(1)-1
  111.     RETURN
  112.  
  113. c2: clr=MENU(1)+7
  114.     RETURN
  115.              
  116. fini: MENU RESET : CLS : STOP
  117.         
  118.